

***************************
*** ANALYSIS FIRM LEVEL ***
***************************



use firm_level.dta


* TABLE 2: Environmental Enforcement and Campaign Contributions
ivreghdfe lnamount  (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1)
sum lnamount lnrep_amount lndem_amount
restore


* TABLE 3: Regulatory Enforcement on Manufacturing Firms
ivreghdfe lnamount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_gov_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_leg_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_gov_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_leg_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1  & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1)
sum lnamount lnrep_amount lnrep_gov_amount lnrep_leg_amount lndem_amount lndem_gov_amount lndem_leg_amount
restore


* TABLE 4: Contributions to Republicans in Competitive Districts
ivreghdfe lnrep_competitive_1  (lnformal_action =frack_firm) if (ind_nonoil ==1  & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
replace extensive_comp1 =1 if rep_competitive_1 > 0
ivreghdfe extensive_comp1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lncont_competitive1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnpc_leg_comp1  (lnformal_action =frack_firm) if (ind_nonoil ==1  & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1)
sum lnrep_competitive_1 extensive_comp1 lncont_competitive1 lnpc_leg_comp1
restore


* Table 5: Contributions to Republicans - Prior Democratic Control
ivreghdfe lnrep_competitive_1  (lnformal_action =frack_firm) if (ind_nonoil ==1  & ind_manuf==1 & battle_st==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe extensive_comp1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1 & battle_st==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lncont_competitive1  (lnformal_action =frack_firm) if (ind_nonoil ==1  & ind_manuf==1 & battle_st==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnpc_leg_comp1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1 & battle_st==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1 & battle_st==1)
sum lnrep_competitive_1 extensive_comp1 lncont_competitive1 lnpc_leg_comp1
restore


* TABLE A6: Descriptive Statistics - Environmental Enforcement and Campaign Contributions
preserve
keep if (ind_nonoil ==1)
sum amount gov_amount leg_amount rep_amount rep_gov_amount rep_leg_amount dem_amount dem_gov_amount dem_leg_amount
sum frack_firm formal_action  amount_lobby num_rep_leg   pc_leg cong_amount cong_rep_amount cong_dem_amount 
restore


* TABLE A7: Environmental Enforcement and Campaign Contributions - OLS
xtreg lnamount lnformal_action i.year if (ind_nonoil ==1), fe robust
xtreg lnrep_amount lnformal_action i.year if (ind_nonoil ==1), fe robust
xtreg lndem_amount lnformal_action i.year if (ind_nonoil ==1), fe robust

preserve
keep if (ind_nonoil ==1 & ind_nonoil==1)
sum lnamount lnrep_amount lndem_amount
restore


* TABLE A8: State Environmental Enforcement and Federal Contributions
ivreghdfe lncong_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lncong_rep_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lncong_dem_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1)
sum lncong_amount lncong_rep_amount lncong_dem_amount
restore


* TABLE A9: Environmental Enforcement and Campaign Contributions - With Covariates
ivreghdfe lnamount lnamount_lobby (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_amount lnamount_lobby (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_amount lnamount_lobby (lnformal_action =frack_firm) if (ind_nonoil ==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1)
sum lnamount lnrep_amount lndem_amount
restore


* TABLE A10: Regulatory Enforcement on Non-Manufacturing Firms
ivreghdfe lnamount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_gov_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_leg_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_gov_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 &  ind_manuf==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_leg_amount  (lnformal_action =frack_firm) if (ind_nonoil ==1 &  ind_manuf==0), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==0)
sum lnamount lnrep_amount lnrep_gov_amount lnrep_leg_amount lndem_amount lndem_gov_amount lndem_leg_amount
restore


* TABLE A11: Informal Enforcement
ivreghdfe lnamount  (lnstate_informal =frack_firm) if (ind_nonoil ==1  & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_gov_amount  (lnstate_informal =frack_firm) if (ind_nonoil ==1  & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lndem_gov_amount  (lnstate_informal =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1)
sum lnamount lnrep_gov_amount lndem_gov_amount 
restore


* TABLE A12: Contributions to Republican Incumbents in Legislative Races
* Incumbents 
ivreghdfe lnrep_leg_inc  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe ext_leg_inc  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnnum_inc_rep  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
* Committees
ivreghdfe lnrep_cont_env  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_cont_energy  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_cont_natres  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1)
sum lnrep_leg_inc ext_leg_inc lnnum_inc_rep lnrep_cont_env lnrep_cont_energy lnrep_cont_natres
restore


* TABLE A13: Conditional Effects on Incumbent Legislators’ Ideology
ivreghdfe lnrep_vcon_inc (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_con_inc  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_lib_inc  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_vlib_inc  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1)
sum lnrep_vcon_inc lnrep_con_inc lnrep_lib_inc lnrep_vlib_inc
restore


* TABLE A14: Contributions to Republicans in Competitive Districts - Extensions
ivreghdfe lnrep_competitive_2  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_competitive_3  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_competitive_4  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lncont_competitive2  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lncont_competitive3  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lncont_competitive4  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1)
sum lnrep_competitive_2 lnrep_competitive_3 lnrep_competitive_4 lncont_competitive2 lncont_competitive3 lncont_competitive4
restore


* TABLE A15: Contributions to Republicans in Non-Competitive Districts
ivreghdfe lnrep_safe_1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_safe_2  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_safe_3  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_demsafe_1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_demsafe_2  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnrep_demsafe_3  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1)
sum lnrep_safe_1 lnrep_safe_2 lnrep_safe_3 lnrep_demsafe_1 lnrep_demsafe_2 lnrep_demsafe_3
restore


* Table A16: Contributions to Republicans - Prior Republican Control
ivreghdfe lnrep_competitive_1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1 & battle_st==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe extensive_comp1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1 & battle_st==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lncont_competitive1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1 & battle_st==0), cluster (firm_state_id) absorb(firm_state_id year) first
ivreghdfe lnpc_leg_comp1  (lnformal_action =frack_firm) if (ind_nonoil ==1 & ind_manuf==1 & battle_st==0), cluster (firm_state_id) absorb(firm_state_id year) first

preserve
keep if (ind_nonoil ==1 & ind_manuf==1 & battle_st==0)
sum lnrep_competitive_1 extensive_comp1 lncont_competitive1 lnpc_leg_comp1
restore















































